package lib.Com;


public class BroadcastSelfSchedule extends Thread {
	/**
	 * Repeats the BroadcastSelf call.
	 */
	private boolean running = true;

	public BroadcastSelfSchedule() {
		super("BroadcastSelfSchedule");
	}

	public void run() {
		do {
			try {
				Container.RefreshIP();
				Thread.sleep(50);
				new BroadcastSelf().start();
				if (Container.knownClients.isEmpty()) {
					Thread.sleep(5000);
				} else {
					for (int i = 0; i < 600; i++) {
						if (Container.knownClients.isEmpty()) {
							break;
						} else {
							Thread.sleep(1000);
						}
					}
				}
			} catch (Exception e) {
			}
		} while (running);
	}

	public void Stop() {
		running = false;
	}

}